home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / prog / cfuncs.zip / CURSOR.C < prev    next >
Text File  |  1991-03-07  |  2KB  |  71 lines

  1. #include <dos.h>
  2. #define MONO 7
  3. int vid_mode = -1;
  4.  
  5. /*-------------------SetCursor--------------------------*/
  6. /*DESCRIPTION: Sets the shape of the cursor.        */
  7. /*                            */
  8. /*USES: nothing                     */
  9. /*IN: cursor.c                        */
  10. /*------------------------------------------------------*/
  11. void SetCursor(unsigned int shape)
  12. {
  13.  union REGS reg;
  14.  
  15.  reg.h.ah = 1;
  16.  reg.x.cx = shape;
  17.  int86(0X10, ®, ®);
  18. } /* setcursor */
  19.  
  20. /*----------------------------OffCursor-----------------*/
  21. /*DESCRIPTION: Turns off the cursor.                */
  22. /*                            */
  23. /*USES: SetCursor                    */
  24. /*IN: cursor.c                        */
  25. /*------------------------------------------------------*/
  26.  
  27. OffCursor()
  28. {
  29.     unsigned int nocursor = 0x2000;
  30.     SetCursor(nocursor);
  31. }
  32.  
  33. /*----------------------------OnCursor--------------------------*/
  34. /*DESCRIPTION: Sets the cursor to a short blinking size.    */
  35. /*    Must be modified for MONO screens.            */
  36. /*                                */
  37. /*USES: SetCursor                        */
  38. /*IN: cursor.c                            */
  39. /*--------------------------------------------------------------*/
  40.  
  41. OnCursor()
  42. {
  43.     if(vid_mode==-1)
  44.       vid_mode = video_mode();
  45.  
  46.     SetCursor((vid_mode==MONO) ? 0x0A0C : 0x0607);
  47.  
  48. /*    unsigned int shortcursor = 0x0607;  for MONO screens = 0x0A0C
  49.     SetCursor(shortcursor);             see mcdisply.c initcursor() */
  50. }
  51.  
  52. /*---------------------------GetCursor--------------------------*/
  53. /*DESCRIPTION: Gets the shape of the current cursor.        */
  54. /*                                */
  55. /*RETURNS: a number that may be passed to SetCursor             */
  56. /*USES: nothing                            */
  57. /*IN: cursor.c                            */
  58. /*--------------------------------------------------------------*/
  59.  
  60. unsigned int GetCursor(void)
  61. {
  62.  union REGS reg;
  63.  
  64.  reg.h.ah = 3;
  65.  reg.h.bh = 0;
  66.  int86(0X10, ®, ®);
  67.  return(reg.x.cx);
  68. } /* getcursor */
  69.  
  70.  
  71.